package com.wz.utils.batch;


import com.google.common.collect.Lists;
import com.wz.utils.batch.config.MainConfig;
import com.wz.utils.batch.entity.User;
import com.wz.utils.batch.service.PayService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MainConfig.class);
        PayService payService = (PayService) ctx.getBean("payServiceImpl");
        ArrayList<User> users = Lists.newArrayList();
        for (int i = 0; i < 10000; i++) {
            User user = new User();
            user.setId(i);
            user.setUserName(i + "a");
            user.setDateTime(new java.util.Date());
            users.add(user);
        }
        payService.batchInsert(users);
    }
}
